package com.lxh.demo.eureka_feign_client;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

/**
 * @create: 2019-08-18 15:11
 * @author: xiaoh.luo001@bkjk.com
 * @description: swagger2描述
 **/
@Configuration(value = "Swagger2")
@EnableSwagger2
public class Swagger2 {

    /**
     * @Date: 2019-08-18
     * @Author: xiaoh.luo001@bkjk.com
     * @Description: swagger2的配置参数
     */
    @Bean(name = "restApi")
    public Docket createRestApi() {
        return new Docket(DocumentationType.SWAGGER_2)
                .apiInfo(apiInfo())
                .select()
                .apis(RequestHandlerSelectors.basePackage("com.lxh.demo.eureka_feign_client"))
                .paths(PathSelectors.any())
                .build();
    }

    /**
     * @Date: 2019-08-18
     * @Author: xiaoh.luo001@bkjk.com
     * @Description: api文档的详细信息
     */
    private ApiInfo apiInfo() {
        return new ApiInfoBuilder()
                .title("Swagger2构建RESTful API")
                .contact(new Contact("罗小辉", "https://blog.csdn.net/a394268045", "380226205@qq.com"))
                .version("1.0")
                .description("eureka和feign结合使用的demo")
                .build();
    }
}















